#!/usr/bin/env bash

echo 'What is the directory name of your new test?'

read dirname

if [ -d tests/e2e/"$dirname" ]
then
    echo "A directory with the name $dirname already exists."
    exit 1
fi

cd tests/e2e
mkdir $dirname

cp -r Example_Test/src "$dirname"/src
cp -r Example_Test/tests $dirname/tests
cp  Example_Test/composer.json $dirname/composer.json
cp  Example_Test/expected-output.txt $dirname/expected-output.txt
cp  Example_Test/infection.json5 $dirname/infection.json5
cp  Example_Test/phpunit.xml $dirname/phpunit.xml
cp  Example_Test/README.md $dirname/README.md

cd $dirname
find ./ -type f -exec sed -i -e "s/ExampleTest/$dirname/g" {} \;

echo "Created the base for a new end-to-end test in directory $dirname"




